package com.tiancheng.trade.settlement.controller.admin;

import com.tiancheng.trade.commom.core.data.Result;
import com.tiancheng.trade.settlement.exception.BusinessException;
import com.tiancheng.trade.settlement.service.settlement.ISelfSupportSettlementService;
import com.tiancheng.trade.settlement.vo.settlement.admin.SelfSupportSettlementVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.validation.Valid;

/**
 * 自营资金清算报表报表
 *
 * @author dell
 */
@RestController
@RequestMapping("/admin/selfSupport/bill")
public class SelfSupportSettlementController {
    @Autowired
    private ISelfSupportSettlementService service;

    @GetMapping("/query")
    public Result query(SelfSupportSettlementVO vo) throws BusinessException {
        return Result.success(service.query(vo));
    }

    @PostMapping("/update")
    public Result update(@RequestBody @Valid SelfSupportSettlementVO vo) throws BusinessException {
        return Result.success(service.update(vo));
    }

    @PostMapping("/noSettlementOrderExport")
    public Result noSettlementOrderExport(@RequestBody @Valid SelfSupportSettlementVO vo, HttpServletRequest request, HttpServletResponse response) throws BusinessException {
        service.noSettlementOrderExport(vo, request, response);
        return Result.success("导出成功");
    }
}
